package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        System.out.println("姓名");
        String name=sc.nextLine();
        System.out.println("密码");
        String psw=sc.nextLine();
        System.out.println("绰号");
        String nick=sc.nextLine();
        System.out.println("年龄");

        int age=sc.nextInt();
        User user=new User(name,psw,nick,age);

        FileOutputStream fos=new FileOutputStream(name+".obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);

        oos.writeObject(user);
        System.out.println("写出完毕");
        oos.close();


    }
}
